//--------------------------------------------------------------
//
// Qizhi Zhang 
// ezhung@gmail.com
// http://www.moorwind.com
//
//--------------------------------------------------------------
package reader.services
{
	import flash.net.URLRequest;
	import flash.net.URLRequestMethod;
	import flash.net.URLVariables;
	import flash.net.navigateToURL;
	
	public class ShareService
	{
		
		/**
		 * Post To MySpace (PTM)
		 * @ see http://creative.myspace.com/design/_om/postmyspace/docsv2/US_english.pdf
		 */
		public static function myspaceComPTM(title:String, content:String, url:String, location:uint = 1):void
		{
			var targetUrl:String = 'http://www.myspace.com/index.cfm?fuseaction=postto&' + 't=' + encodeURIComponent(title) + '&u=' + encodeURIComponent(url) + '&l=' + location + '&c=' + encodeURIComponent(content);
			
			/* var param:URLVariables = new URLVariables();
			param.fuseaction = "postto";
			param.t = title;
			param.c = content;
			param.u = url;
			param.l = location;
			
			var request:URLRequest = new URLRequest(targetUrl);
			request.method = URLRequestMethod.POST;
			request.data = param; */
			navigateToURL(new URLRequest(targetUrl));
		}
		
		/**
		 * Share To Facebook
		 * @ see http://www.facebook.com/share_partners.php
		 */
		public static function facebookShare(title:String, url:String):void
		{			
			var targetUrl:String = 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(url)+'&t='+encodeURIComponent(title);
			navigateToURL(new URLRequest(targetUrl));
		}

	}
}